import axios from '@/libs/api.request'
import qs from "qs";

// 获取人员列表
export const getCompanyUser = (params) => {
  return axios.request({
      url: '/user/companyUser',
      method: 'get',
      params
  })
}

// 获取人员详情
export const getOneCompanyUser = (companyUserId) => {
  return axios.request({
      url: `/user/companyUser/${companyUserId}`,
      method: 'get'
  })
}

// 新增人员
export const addCompanyUser = (params) => {
  return axios.request({
      url: `/user/companyUser`,
      method: 'post',
      params
  })
}

// 修改人员
export const editCompanyUser = (companyUserId,params) => {
  return axios.request({
      url: `/user/companyUser/${companyUserId}`,
      method: 'put',
      params
  })
}

// 删除人员
export const deleteCompanyUser = (companyUserId) => {
  return axios.request({
      url: `/user/companyUser/${companyUserId}`,
      method: 'delete'
  })
}

// 获取人员关联的项目点
export const getCompanyUserOrg = (companyUserId,params) => {
  return axios.request({
      url: `/user/companyUser/${companyUserId}/org`,
      method: 'get',
      params
  })
}

// 新增人员关联的项目点
export const addCompanyUserOrg = (companyUserId,params) => {
  return axios.request({
      url: `/user/companyUser/${companyUserId}/org`,
      method: 'post',
      data:qs.stringify(params)
  })
}

// 删除人员关联的项目点
export const deleteCompanyUserOrg = (companyUserId,orgId) => {
  return axios.request({
      url: `/user/companyUser/${companyUserId}/org/${orgId}`,
      method: 'delete'
  })
}
